package com.okilo.online.app.pet

import com.okilo.online.app.common.OkiloComPet
import com.okilo.online.app.configs.OkiloConfigs
import com.okilo.online.app.request.IHttpCallback
import com.okilo.online.app.pet.view.IOkiloFeedback
import org.json.JSONObject

/**
 * 意见反馈
 */
class OkiloFeedbackPet(private val iView: IOkiloFeedback?): OkiloComPet(iView) {

    /**
     * 提交意见反馈
     * /v1/feedback
     */
    fun sOkiloFeedbackSubmitRequest(params: JSONObject){
        val httpUrl = OkiloConfigs.gOkiloRequestUrl()
        doPostAction(httpUrl,params,object : IHttpCallback {
            override fun onRequestSuccess(data: JSONObject) {
                val msg = data.optString("msg")
                iView?.sOkiloFeedbackSubSuccess(msg)
            }

            override fun onRequestError(error: JSONObject) {
            }

            override fun onRequestFinish() {
                iView?.hideOkiloLoading()
            }
        })
    }
}